package com.codingman.springbootdemo7;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class EmployeeDaoTest1 {

	private 
	
	@Autowired
	EmployeeDao dao;

	@Test
	void test() {
		assertTrue(dao != null);
		
		Employee e = new Employee();
		e.setName("ddd");
		e.setPassword("789");
		e.setEmail("ddd@codingman.com");
		e.setSex("F");
		e.setCountry("China");
		
//		dao.save(e);
		
//		e.setId(1);
//		e.setName("fff");
//		assertTrue(dao.update(e));
		
//		assertTrue(dao.delete(1));
		
//		e = dao.getEmployeeById(2).get();
//		System.out.println(e);
		
//		e = dao.getEmployeeById(100).orElse(new Employee());
//		e = dao.getEmployeeById(100).orElseThrow(() -> new RuntimeException("空容器异常"));
				
//		List<Employee> employees = dao.getAllEmployees();
//		for(Employee employee: employees)
//		{
//			System.out.println(employee);
//		}
	}

}
